{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "非贫困户，不需要帮扶\n"
     ]
    }
   ],
   "source": [
    "class poor_households():\n",
    "    def __init__(self,yiwu,zhufang,yinshui,rou):\n",
    "        self.yiwu=yiwu\n",
    "        self.zhufang=zhufang\n",
    "        self.yinshui=yinshui\n",
    "        self.rou=rou\n",
    "    def is_poor(self):\n",
    "        count=0\n",
    "        if self.yiwu==0:\n",
    "            count+=1\n",
    "        if self.zhufang==0:\n",
    "            count+=1\n",
    "        if self.yinshui==0:\n",
    "            count+=1\n",
    "        if self.rou==0:\n",
    "            count+=1\n",
    "        if count>2:\n",
    "            print(\"贫困户\")\n",
    "    def bangfu_need(self):\n",
    "        count=0\n",
    "        if self.yiwu==0:\n",
    "            count+=1\n",
    "        if self.zhufang==0:\n",
    "            count+=1\n",
    "        if self.yinshui==0:\n",
    "            count+=1\n",
    "        if self.rou==0:\n",
    "            count+=1\n",
    "        if count>2:\n",
    "            print(\"贫困户\")\n",
    "            bangfu=input(\"是否对其帮扶Y/N:\")\n",
    "            if bangfu=='Y'| bangfu=='y':\n",
    "                print(\"帮扶成功\")\n",
    "            else:\n",
    "                print(\"帮扶失败\")\n",
    "        else:\n",
    "            print(\"非贫困户，不需要帮扶\")\n",
    "poor_guy1=poor_households(1,1,1,1)\n",
    "poor_guy2=poor_households(0,0,0,0)\n",
    "poor_guy3=poor_households(0,1,0,1)\n",
    "poor_guy4=poor_households(1,1,1,0)\n",
    "poor_guy1.bangfu_need()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "False\n",
      "体重正常\n",
      "BMI可能偏大\n"
     ]
    }
   ],
   "source": [
    "class student():\n",
    "    def __init__(self,name,score,sleep_time):\n",
    "        self.name=name\n",
    "        self.score=score\n",
    "        self.time=sleep_time\n",
    "    def is_fat(self,standard_score=90,standard_time=6):\n",
    "        if (self.score>standard_score) & (self.time<standard_time):\n",
    "            print(\"BMI可能偏大\")\n",
    "        else:\n",
    "            print(\"体重正常\")\n",
    "                \n",
    "student1=student('xiaoniu',80,5)\n",
    "student2=student('xiaoniuniu',100,5)\n",
    "student3=student('xiaoxiaoniu',100,7)\n",
    "#print((student1.score>90)&(student1.time<6))\n",
    "student1.is_fat()\n",
    "student1.is_fat(70,6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "趋向正常\n"
     ]
    }
   ],
   "source": [
    "class running_club(student):\n",
    "    def __init__(self,name,score,sleep_time,run):\n",
    "        super().__init__(name,score,sleep_time)\n",
    "        self.run=run\n",
    "    def is_fat(self,standard_score=90,standard_time=6):\n",
    "        if (self.score>standard_score) & (self.time<standard_time):\n",
    "            if self.run>30:\n",
    "                print(\"趋向正常\")\n",
    "            else:\n",
    "                print(\"BMI可能偏大\")\n",
    "        else:\n",
    "            print(\"体重正常\")\n",
    "runner=running_club('xiaoniu',80,5,31)\n",
    "runner2=running_club('xiaoniuniu',100,5,30)\n",
    "runner3=running_club('xiaoxiaoniu',100,7,30)\n",
    "runner.is_fat(70,6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
